/**
 * 
 */

package com.applabs.mydiary.provider;

import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

/**
 * @author praveenthota
 */
public class DiaryEventTable {
    // Database table
    public static final String TABLE_NAME = "diaryevents";

    public static final String COLUMN_ID = "_id";

    public static final String COLUMN_EVT_DATE = "eventdate";

    public static final String COLUMN_EVT_STIME = "starttime";

    public static final String COLUMN_EVT_ETIME = "endtime";

    public static final String COLUMN_EVT_LATI = "latitude";

    public static final String COLUMN_EVT_LONG = "longitude";

    public static final String COLUMN_EVT_NOTES = "notes";

    public static final String COLUMN_EVT_ADDR = "address";

    // Database creation SQL statement
    private static final String DATABASE_CREATE = "create table " + TABLE_NAME + "(" + COLUMN_ID
            + " integer primary key autoincrement, " + COLUMN_EVT_DATE + " text not null, "
            + COLUMN_EVT_STIME + " text not null, " + COLUMN_EVT_ETIME + " text not null, "
            + COLUMN_EVT_LATI + " integer," + COLUMN_EVT_LONG + " integer," + COLUMN_EVT_NOTES
            + " text not null, " + COLUMN_EVT_ADDR + " text not null " + ");";

    public static void onCreate(SQLiteDatabase database) {
        database.execSQL(DATABASE_CREATE);
    }

    public static void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion) {
        Log.w(DiaryEventTable.class.getName(), "Upgrading database from version " + oldVersion
                + " to " + newVersion + ", which will destroy all old data");
        database.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
        onCreate(database);
    }

}
